/**
* file name  : Allele.java
* authors    : Luciano Xumerle
* created    : lun 13 set 2004 14:53:05 CEST
*
* Copyright (c) 2004-2005 Luciano Xumerle. All rights reserved.
*
* This file is part of gephinfo.
*
* gephinfo is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
*/

package it.ciano.jenoware;

import java.lang.Float;

/**
 * The class extends Value and stores the allele value (String or numeric).
 *
 * @author Luciano Xumerle
 * @version 0.0.1
 */
final public class Allele extends Value implements Comparable {

    /**
     * Class Constructor.
     *
     * @param allele the value.
     */
    public Allele ( String allele ) {
        super ( allele, true );
    }

    /**
     * Class Constructor.
     *
     * @param a the value.
     */
    public Allele ( int a ) {
        super ( ( new Integer ( a ) ).toString(), true );
    }

    /**
     * Class Constructor.
     *
     * @param a the value.
     */
    public Allele ( Integer a ) {
        super ( a.toString(), true );
    }

    /**
     * Class Constructor.
     *
     * @param a the value.
     */
    public Allele ( Float a ) {
        super ( a.toString(), true );
    }

    /**
     * Empty Class Constructor.
     * The resulting Allele isn't valid.
     *
     */
    public Allele() {
        super ( "", true );
    }

    /**
     * Returns the Allele object having the integer value.
     * Useful if allele have a float value.
     *
     * @return the Allele object (no valid Allele if this is not numeric).
     */
    public Allele getIntAllele() {
        return new Allele ( super.getInt() );
    }

    /**
     * Overriding toString method.
     *
     * @return the Allele value.
     */
    public String toString() {
        return super.toString();
    }

    /**
     * Overriding equals method.
     *
     * @param o the object to compare.
     * @return true or false.
     */
    public boolean equals ( Object o ) {
        return super.equals ( o );
    }

    /**
     * Overriding clone method.
     *
     * @return a new cloned object ID
     */
    public Object clone() {
        Allele cloned = new Allele ( super.getValue() );
        return ( Object ) cloned;
    }

    /**
     * Overriding compareTo method.
     *
     * @param o the object to compare.
     * @return an integer less or equal or major of 0.
     */
    public int compareTo ( Object o ) {
        return super.compareTo ( o );
    }

} // end class

